<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Admins extends Model
{
    //
    protected $fillable = ['username', 'nickname', 'password', 'avatar', 'last_login_time', 'last_login_ip'];

    /**
     * 反向关联   管理员对应角色
     * Author: 陈坤
     * Date: 2019/1/18 18:21
     */
    public function role()
    {
        return $this->belongsToMany('App\Models\Roles', 'admin_roles', 'admin_id', 'role_id');
    }
}
